package com.mit.web.view.component.tree
{
	import mx.controls.treeClasses.TreeItemRenderer;
	import mx.controls.treeClasses.TreeListData
	
	public class CountChildrenTreeItemRenderer extends TreeItemRenderer
	{
		public function CountChildrenTreeItemRenderer()
		{
			super();
		}
		
		override protected function updateDisplayList(unscaledWidth:Number, 
													  unscaledHeight:Number):void {
			
			super.updateDisplayList(unscaledWidth, unscaledHeight);
			
			if(super.data)
			{
				if(TreeListData(super.listData).hasChildren)
				{
					//显示子项有多少个
					if(data.children.length > 0)
						super.label.text =  TreeListData(super.listData).label + 
						"(" + this.data.children.length + ")";
					else
						super.label.text =  TreeListData(super.listData).label;
				}
			}
		}
	}
}